<!--
 * @Author: 马潭龙
 * @Date: 2022-01-13 16:45:26
 * @LastEditTime: 2022-01-19 21:05:39
 * @LastEditors: 马潭龙
 * @Description: 
 * @FilePath: \devlomp\icm-vue-master\src\views\hifar\pm\modules\HfPmProjectToolRecordsModal.vue
 * 可以输入预定的版权声明、个性签名、空行等
-->
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <hf-pm-project-tool-records-form ref="realForm" @ok="submitCallback" :tree="treeData" :disabled="disableSubmit"/>
  </j-modal>
</template>

<script>

  import HfPmProjectToolRecordsForm from './HfPmProjectToolRecordsForm'

  export default {
    name: 'HfPmProjectToolRecordsModal',
    components: {
      HfPmProjectToolRecordsForm
    },
    props:{
      tree:{
        type:Array,
        default:()=>[]
      }
    },
    watch:{
    tree: {
      immediate: true,
      handler(val) {
        this.treeData = val
      },
    },
  },
    data() {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
        treeData:[]
      }
    },
    methods:{
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.$refs.realForm.close()
        this.visible=false
      },
      handleOk () {
        this.$emit('ok');
        this.$refs.realForm.submitForm()
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>

<style scoped>
</style>